#pragma once

#include <QObject>
#include <QGraphicsItem>
#include <QPainter>
#include <QPropertyAnimation>
#include <QGraphicsView>

//#include "sysinfoapi.h" 
//SetSystemTim

class Car : public QObject, public QGraphicsItem
{
	Q_OBJECT
	Q_PROPERTY(QPointF pos READ pos WRITE setPos)

public:
	Car(int x, int w, QObject* parent = nullptr);
	~Car();

	void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget);
	void move(int target);
	void set_y(int y);
	void set_direct(bool to_east);

	QRectF boundingRect() const;

	int _height();

	int pos_num = 0;

private:

	int scaled(int pos);

	int _x = 0, _y = 0, _width = 0;
	int _pos_last = 1;

	QPropertyAnimation* anim;

	bool is_to_east = false;

};

